/**
 * 
 */
package com.suneee.category.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.suneee.orm.annotation.Column;
import com.suneee.orm.annotation.Entity;
import com.suneee.orm.annotation.GeneratedValue;
import com.suneee.orm.annotation.GenerationType;
import com.suneee.orm.annotation.Id;
import com.suneee.orm.annotation.Table;
import com.suneee.orm.annotation.Transient;

/**
 * @author liuxh 类目管理属性类
 */
@Entity
@Table(name = "t_category")
@SuppressWarnings("serial")
public class Category implements Serializable {

	/**
	 * 类目ID
	 */
	@Id
	@Column(name = "category_code", nullable = false)
	@GeneratedValue(strategy = GenerationType.TABLE)
	private String categoryCode;

	/**
	 * 类目名称
	 */
	@Column(name = "name", nullable = false)
	private String name;

	/**
	 * 图片
	 */
	@Column(name = "image", nullable = false)
	private String image;

	/**
	 * 排序
	 */
	@Column(name = "order_number", nullable = false)
	private int orderNumber;

	/**
	 * 分佣比例
	 */
	@Column(name = "commis_rate", nullable = false)
	private int commisRate;

	/**
	 * 上级目录
	 */
	@Transient
	private String parentCode;
	
	/**
	 * 目录级别
	 */
	@Transient
	private int level;
	
	/**
	 * 子类目
	 */
	@Transient
	private List<Category> children;

	public String getParentCode() {
		return parentCode;
	}

	public void setParentCode(String parentCode) {
		this.parentCode = parentCode;
	}

	public String getCategoryCode() {
		return categoryCode;
	}

	public void setCategoryCode(String categoryCode) {
		this.categoryCode = categoryCode;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public int getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(int orderNumber) {
		this.orderNumber = orderNumber;
	}

	public int getCommisRate() {
		return commisRate;
	}

	public void setCommisRate(int commisRate) {
		this.commisRate = commisRate;
	}

	public List<Category> getChildren() {
		if (children == null) {
			children = new ArrayList<>();
		}
		return children;
	}

	public void setChildren(List<Category> children) {
		this.children = children;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	
}
